package com.apex.auth;

import com.apex.shared.core.utils.IpUtils;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;

/**
 * Apex Auth 鉴权模块
 *
 * @author MoNaiHui
 */
@SpringBootApplication
@EnableDubbo
public class ApexAuthApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext application = SpringApplication.run(ApexAuthApplication.class, args);
        Environment env = application.getEnvironment();
        String port = env.getProperty("server.port");
        String contextPath = env.getProperty("server.servlet.contextPath", "");
        String ip = IpUtils.getHostIp();
        
        System.out.println("✅ 鉴权服务启动成功!");
        System.out.println("🔍 服务访问信息:");
        System.out.println("➭ 本地访问: http://localhost:" + port + contextPath);
        System.out.println("➭ 外网访问: http://" + ip + ":" + port + contextPath);
    }

}
